package cn.foolishbird.crow.enumeration;


import cn.foolishbird.crow.core.CrowEnum;
import cn.foolishbird.crow.enumeration.annotation.DefDictionary;
import cn.foolishbird.crow.enumeration.annotation.Dictionary;

import java.util.Objects;

/**
 * @author foolish-bird
 */
@Dictionary(value = "Whether", name = "是/否")
public enum WhetherEnum implements CrowEnum {

    @DefDictionary
    YES(1, "是"),
    NO(2, "否");

    /**
     * 状态
     */
    private final Integer status;

    /**
     * 状态说明
     */
    private final String content;

    WhetherEnum(Integer state, String desc) {
        this.status = state;
        this.content = desc;
    }

    @Override
    public Integer value() {
        return this.status;
    }

    @Override
    public String content() {
        return this.content;
    }

    /**
     * 转换成boolean
     *
     * @param whether 枚举对象
     * @return 如果是yes，则返回true
     */
    public static boolean converterBoolean(WhetherEnum whether) {
        return Objects.equals(YES, whether);
    }
}
